package pe.gob.osinergmin.utils;

import android.content.Context;
import android.content.SharedPreferences;

public class PuntoControlUpdateControl {

    private static final String PREFS_NAME ="syncronizeState";

    private static final String LAST_UPDATE = "LAST_UPDATE";

    private SharedPreferences updateControlPrefs;

    public PuntoControlUpdateControl(Context context) {
        this.updateControlPrefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
    }

    public void saveUpdateDate(String updateDate){
        SharedPreferences.Editor editor = updateControlPrefs.edit();
        editor.putString(LAST_UPDATE, updateDate);
        editor.commit();
    }

    public String getLastUpdateDate(){
        String lastUpdateDate = updateControlPrefs.getString(LAST_UPDATE,null);
        return lastUpdateDate;
    }
}
